package org.example.service.impl;


import org.example.bean.CakeCatalog;
import org.example.bean.User;
import org.example.mapper.CakeCatalogMapper;
import org.example.service.CakeCatelogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class CakeCatalogServiceImpl implements CakeCatelogService {

        private CakeCatalogMapper cakecatalogMapper;

        @Autowired
        public void setCatalogMapper(CakeCatalogMapper cakecatalogMapper) {
            this.cakecatalogMapper = cakecatalogMapper;
        }

        @Override
        public List<CakeCatalog> selectAll() {
            List<CakeCatalog> list = new ArrayList<>();
            List<CakeCatalog> catalogs = cakecatalogMapper.selectAll();
            for (CakeCatalog cata : catalogs) {
                    list.add(cata);
                }
            return list;
        }

    @Override
    public void deleteId(int id) {
        cakecatalogMapper.deleteId(id);
    }

    @Override
    public void insert(List<CakeCatalog> list) {
        cakecatalogMapper.insert(list);
    }

    @Override
    public CakeCatalog selectByTitle(String title) {
        return cakecatalogMapper.selectByTitle(title);
    }


}

